home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / dialogic.zip / DEMO.BAS next >
BASIC Source File  |  1990-01-31  |  12KB  |  351 lines

  1. '
  2. '┌───────────────────────────────────────────────────────┐
  3. '│ Written by Jonathan S. Waldman                        │
  4. '│ (C) 1989, 1990 Jonathan S. Waldman & Dialog Software  │
  5. '│ (C) Crescent Software.                                │
  6. '│ All rights reserved.                                  │
  7. '└───────────────────────────────────────────────────────┘
  8.  
  9. DEFINT A-Z
  10. DECLARE SUB ByeBye ()
  11. DECLARE SUB DiaLogic (DB() AS ANY, LB() AS ANY, Action, Focus, Ky$)
  12. DECLARE SUB ReDoScr ()
  13. DECLARE SUB Rollover ()
  14. DECLARE SUB Marquee (X$, Row, Colr)
  15.  
  16.    '$INCLUDE: 'DIALOGIC.BI'
  17.  
  18.    DIM SHARED Ky$, HasColor, c1, c2, c3, c4, c5, c6, c7
  19.  
  20.    CALL InitMouse(X)       'initialize the mouse
  21.    CALL TextCursor(0, 4)   'initialize the text cursor
  22.    CALL HideCursor         'hide the cursor
  23.  
  24.    WIDTH , 25              'set screen to 25-line mode
  25.    CLS
  26.    PLAY "L64<EC>"
  27.    INPUT "Do you have a color monitor (Y/N)"; a$
  28.  
  29.    c1 = 112
  30.    c4 = 127
  31.    c6 = 15
  32.  
  33.    IF LEFT$(UCASE$(a$), 1) = "Y" THEN
  34.       HasColor = -1
  35.       c2 = 113
  36.       c3 = 2
  37.       c5 = 1
  38.       c7 = 10
  39.       c8 = 14
  40.    ELSE
  41.       HasColor = 0
  42.       c2 = 112
  43.       c3 = 7
  44.       c5 = 0
  45.       c7 = 15
  46.       c8 = 7
  47.    END IF
  48.  
  49.    COLOR , c5              'set a background
  50.    CLS                     'clear the screen
  51.  
  52.    COLOR c6
  53.    LOCATE 2, 1
  54.    PRINT " DiaLogic Demo   -  A powerful and elegant dialog box utility for QuickBASIC"
  55.    PRINT " Version 1.4E    -  January 31, 1990"
  56.    PRINT " "; STRING$(75, 196)
  57.    COLOR c8
  58.    PRINT " Dialog Software"
  59.    PRINT " Box 9889 at 1101 Wilson Boulevard"
  60.    PRINT " Arlington, Virginia 22209-0889"
  61.    PRINT " "; STRING$(75, 196)
  62.    PRINT
  63.    PRINT " (703) 528-1505   Questions and general information."
  64.    PRINT "                  Best time to reach a technician: 8:30 a.m. to 11:30 a.m."
  65.    PRINT "                  If a technician is not available, calls are returned on a"
  66.    PRINT "                  collect-basis only.  Written comments or questions are"
  67.    PRINT "                  welcome."
  68.    PRINT
  69.    PRINT " -  a l s o  -"
  70.    PRINT
  71.    PRINT " 1-800-DIALOG-1   Order line only."
  72.    PRINT " 1-800-342-5641"
  73.    PRINT
  74.    PRINT " Copyright (C) 1989, 1990 Jonathan S. Waldman & Dialog Software."
  75.    PRINT " All rights reserved."
  76.    LOCATE 24, 1
  77.    COLOR c7 + 16: PRINT "<"; : COLOR c6
  78.    PRINT " Press any key to view demo "; : COLOR c7 + 16: PRINT ">"; : COLOR 15, 0
  79.  
  80.  
  81.    DO
  82.    LOOP UNTIL INKEY$ <> ""
  83.  
  84.    CLS
  85.    COLOR 8, 7                 'set backdrop color
  86.    PRINT STRING$(2000, 176);  'print backdrop character
  87.    LOCATE 25, 1
  88.    PRINT STRING$(80, 176);
  89.    RANDOMIZE (INT(TIMER))     'get a random number; use clock as seed
  90.  
  91.    CALL ShowCursor            'show the mouse cursor
  92.    ReDoScr                    'color the screen nicely
  93.  
  94.    DO
  95.    LOOP UNTIL INKEY$ = ""
  96.  
  97.    '$DYNAMIC                  'make use of dynamic arrays
  98.  
  99.    Level% = 1                 'set Level to 1
  100.    REDIM SHARED DB(2, 20) AS DialogType   'REDIM our arrays
  101.    REDIM SHARED LB(55) AS DialogText
  102.  
  103.    DO
  104.    LOOP UNTIL INKEY$ = ""
  105.  
  106.    '$INCLUDE: 'Dialog1.db'                'define the first template
  107.    DiaLogic DB(), LB(), 0, 3, Ky$         'call DiaLogic
  108.    ReDoScr                                'change the background
  109.  
  110.    '$INCLUDE: 'Dialog20.db'               'most of these calls to DiaLogic
  111.    DiaLogic DB(), LB(), 0, 0, Ky$         'follow the same form . . .
  112.    ReDoScr                                'we keep the same arrays active
  113.                                           'and keep Level at 1
  114.    '$INCLUDE: 'Dialog2.db'
  115.    DiaLogic DB(), LB(), 0, 0, Ky$
  116.    ReDoScr
  117.  
  118.    '$INCLUDE: 'Dialog3.db'
  119.    DiaLogic DB(), LB(), 0, 0, Ky$
  120.    ReDoScr
  121.  
  122.    '$INCLUDE: 'Dialog4.db'
  123.    DiaLogic DB(), LB(), 0, 0, Ky$
  124.    ReDoScr
  125.                'This shows how to modify the look of a dialog box
  126.                'by using PRINT statements from the calling program.
  127.  
  128.                                        'first, call DiaLogic with an
  129.    '$INCLUDE: 'Dialog5.db'             'Action of 1
  130.    CALL HideCursor                     'remember this step!  It will pre-
  131.    DiaLogic DB(), LB(), 1, 0, Ky$      'vent the mouse cursor from leaving
  132.                                        'a mark on the screen after printing
  133.    LOCATE 14, 25
  134.    PRINT "Select those words which are both";
  135.    LOCATE 15, 25
  136.    PRINT "correctly-spelled last names of";
  137.    LOCATE 16, 25
  138.    PRINT "music composers and nouns in";
  139.    LOCATE 17, 25
  140.    PRINT "the English language.";
  141.  
  142.    CALL ShowCursor                     'turn the cursor back on
  143.  
  144.    DiaLogic DB(), LB(), 7, 0, Ky$      'call DiaLogic again with Action 7
  145.    REDIM SHARED LB(30) AS DialogText   'clear and REDIM the LB() array
  146.  
  147.    Level% = 2                          'set Level to 2 for a stack dialog box
  148.    '$INCLUDE: 'Dialogg.db'
  149.    IF Ky$ <> CHR$(27) THEN
  150.       IF Ky$ = CHR$(13) AND DB(1, 4).Default = 0 AND DB(1, 5).Default = 0 AND DB(1, 6).Default = -1 THEN
  151.                                           'correct answers were selected
  152.          LB(1).Text = "You are correct!"  'define LB() element number one
  153.          DB(2, 2).NumberTwo = 1           'set the number of lines in the message
  154.          DiaLogic DB(), LB(), 0, 0, Ky$   'call DiaLogic at Level 2 w/ Action 0
  155.       ELSE
  156.          LB(1).Text = "Sorry ..."         'if incorrect, print the correct
  157.          LB(2).Text = ""                  'answers
  158.          LB(3).Text = "John Cage is a modern expressionist"
  159.          LB(4).Text = "composer.  Philip Glass is a modern"
  160.          LB(5).Text = "minimalist composer."
  161.          DB(1, 2).NumberTwo = 5           'set 5 as highest LB() element
  162.          DiaLogic DB(), LB(), 0, 0, Ky$   'for this list box
  163.       END IF
  164.    END IF
  165.  
  166.    DiaLogic DB(), LB(), 5, 0, Ky$      'remove the Level-2 dialog box
  167.    ReDoScr
  168.    Level% = 1
  169.    '$INCLUDE: 'Dialog6.db'
  170.  
  171.    DiaLogic DB(), LB(), 1, 0, Ky$
  172.    LOCATE 14, 10
  173.    PRINT "Cluster One"
  174.    LOCATE 14, 31
  175.    PRINT "Cluster Two"
  176.    LOCATE 14, 52
  177.    PRINT "Cluster Three"
  178.    DiaLogic DB(), LB(), 7, 0, Ky$
  179.    DiaLogic DB(), LB(), 5, 0, Ky$
  180.    ReDoScr
  181.    CALL Rollover
  182.    CALL ByeBye
  183. END
  184.  
  185. REM $STATIC
  186. SUB ByeBye
  187.   
  188.    COLOR 7, 0
  189.    CALL HideCursor
  190.    CLS
  191.    COLOR 15
  192.    PRINT
  193.    PRINT " "; STRING$(75, 196)
  194.    COLOR 7
  195.    PRINT "  DiaLogic is extremely powerful and for this reason this demo can not"
  196.    PRINT "  be exhaustive.  You should know that all text boxes, list boxes, check"
  197.    PRINT "  boxes, and option buttons can be refreshed on-the-fly to reflect new"
  198.    PRINT "  information."
  199.    COLOR 15
  200.    PRINT " "; STRING$(75, 196)
  201.    PRINT
  202.    COLOR 7
  203.    PRINT "  Thank you for reviewing DiaLogic.  Remember that you have a QB 4.x-"
  204.    PRINT "  compatible DiaLogic Quick Library (included with this ZIP file).  This will"
  205.    PRINT "  allow you to experiment with the actual DiaLogic program while in the"
  206.    PRINT "  environment.  If you decide you like the program, you may order it by"
  207.    PRINT "  calling the toll-free number below.  For $79.95, registered users will"
  208.    PRINT "  receive commented BASIC source code; DiaLogic.LIB, which allows stand-"
  209.    PRINT "  alone .EXE files to be created; the latest version; a printed user's"
  210.    PRINT "  manual; and technical support."
  211.    COLOR 15
  212.    PRINT
  213.    PRINT "           (c) 1989, 1990 Dialog Software.  All rights reserved."
  214.    PRINT "      Orders: 1-800-342-5641.             Other Info: 1-703-528-1505."
  215.    COLOR 7
  216.    PRINT
  217.    PRINT "  See ORDERFRM.TXT for an actual order form with full order information.";
  218.    X$ = INPUT$(1)
  219.    CLS
  220.  
  221. END SUB
  222.  
  223. SUB Marquee (X$, Row%, Colr%) STATIC
  224.  
  225.     STATIC P%                   'remembers the current position between calls
  226.  
  227.     H% = POS(0)                 'save the current cursor position
  228.     V% = CSRLIN
  229.     L% = LEN(X$)                'we need to know the length
  230.  
  231.     P% = P% + 1                 'advance to the next character
  232.     IF P% > L% THEN P% = 1      'wrap around at the end
  233.  
  234.     LOCATE Row%, 40 - L% \ 2
  235.     CALL MQPRINT(RIGHT$(X$, L% - P% + 1) + LEFT$(X$, P% - 1), Colr%)
  236.  
  237.     LOCATE V%, H%               'restore